//
// Created by 123 on 2025/1/8.
//
#include "list"
#include "iostream"
using namespace std;

void printList(list<int>& li){
    for(list<int>::const_iterator it=li.begin();it!=li.end();it++){
        cout << *it << " ";
    }
    cout << endl;
}

void test(){
    list<int> l1;
    l1.push_back(10);
    l1.push_back(10);
    l1.push_front(20);
    l1.push_front(20);
    printList(l1);

    l1.pop_front();
    printList(l1);

    l1.pop_back();
    printList(l1);

    list<int>::iterator it = l1.begin();
    l1.insert(++it,1000);
    printList(l1);

    it = l1.begin();
    l1.erase(++it);
    printList(l1);

    l1.push_back(1000);
    printList(l1);
    l1.remove(1000);


    cout << "first ele=" << l1.front() << endl;
    cout << "last ele=" << l1.back() << endl;
//   list<int>::iterator s = l1.begin();
//   s = s+1;


    l1.clear();
    printList(l1);

}

int main134(){
    test();
    return 0;
}